{% extends "base.html" %}

{% block title %}留言板{% endblock %}

{% block page_content %}
    <form method="POST">
    <input type="text" name="search_Item" placeholder="Search for..." autocomplete="off">
    <input type="submit" value="Go!">
    </form>
    <script src="http://127.0.0.1:5000/static/logic.js"></script>
    <table class="table table-bordered">
    <tr>
        <th>#</th>
        <th>Title</th>
        <th>Control</th>
    </tr>
        {% if condition %}
            {% for m in message %}
                <tr>
                    <td>{{ m['autoID'] }}</td>
                    <td id="{{ m['autoID'] }}_">{{ m['title1'] }}</td>
                    <td>
                        <button id="{{ m['autoID'] }}1" type="submit" onclick="btnAction_Done('{{ m['autoID'] }}_',this.id,'{{ m['autoID'] }}')">{{ m['status'] }}</button>
                        <button id="{{ m['autoID'] }}" type="submit" onclick="btnAction_Edit(this.id)">Edit</button>
                        <button type="submit" onclick="btnAction_Remove('{{ m['autoID'] }}')">Remove</button>
                    </td>
                </tr>
            {% endfor %}
        {% else %}
            {% for d in data %}
                <tr>
                    <td>{{ d['autoID'] }}</td>
                    <td id="{{ d['autoID'] }}_">{{ d['title1'] }}</td>
                    <td>
                        <button id="{{ d['autoID'] }}1" type="submit" onclick="btnAction_Done('{{ d['autoID'] }}_',this.id,'{{ d['autoID'] }}')">{{ d['status'] }}</button>
                        <button id="{{ d['autoID'] }}" type="submit" onclick="btnAction_Edit(this.id)">Edit</button>
                        <button type="submit" onclick="btnAction_Remove('{{ d['autoID'] }}')">Remove</button>
                    </td>
                </tr>
            {% endfor %}
        {% endif %}
    </table>
    <form method="POST">
    <input type="text" name="add_Item" placeholder="type something here..." autocomplete="off">
    <input type="submit" value="Add New Item">
    </form>
    <br>
    <button disabled="disabled">All({{ info[0] }})</button>
    <button disabled="disabled">Done({{ info[1] }})</button>
    <button disabled="disabled">Active({{ info[2] }})</button>
{% endblock %}
